package com.calvin.study.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import com.calvin.study.model.sys.SysUser;
import com.calvin.study.service.sys.security.MethodELService;

@Controller
public class TestController {
	
	@Autowired
	private MethodELService methodEl;
	
	 // 登录
    @PostMapping("/login")
    public String index(String username,String password) {
        return "index";
    }

    // 日志管理
    @GetMapping("/syslog")
    public String showOrder() {
        return "syslog";
    }

    // 用户管理
    @GetMapping("/sysuser")
    public String addOrder() {
        return "sysuser";
    }

    // 具体业务一
    @GetMapping("/biz1")
    public String updateOrder() {
    	
    	List<SysUser> sysUsers = methodEl.findAll();
    	System.out.println(sysUsers);
    	
    	SysUser sysuser = methodEl.findUser();
    	System.out.println(sysuser);
    	
    	List<SysUser> sysusers = methodEl.findAllPD();
    	System.out.println(sysusers);
    	
    	List<Integer> ids  = new ArrayList<Integer>();
    	ids.add(1);
    	ids.add(2);
    	methodEl.delete(ids);
    	
    	
        return "biz1";
    }

    // 具体业务二
    @GetMapping("/biz2")
    public String deleteOrder() {
        return "biz2";
    }
}
